package com.bigflexlib.ds.op
{
	import com.bigflexlib.ds.container.zet.IOWSet;
	import com.bigflexlib.ds.container.zet.IRWSet;
	import com.bigflexlib.ds.container.zet.impl.RWDictionarySet;
	import com.bigflexlib.ds.container.zet.impl.owSet;
	import com.bigflexlib.utils.IOperator;
	import com.bigflexlib.utils.BasicTestBase;

	public class SetFilterOpTest extends BasicTestBase
	{

		
		public function testGeneral( ):void
		{
		
			
			var source:IOWSet = owSet( );
			var target:IRWSet = new RWDictionarySet( );
			
			
			// both are empty
			assertTrue( source.compare( target ).isEqual );

			source.add( "a" );
			source.add( "b" );
			source.add( "X" );
			
			var op:IOperator = new SetFilterOp( source, target, onlyLowerCase );
		
			assertTrue( target.compare( owSet( [ "a" , "b" ] ) ) );
		
			source.add( "c" );
			source.add( "Y" );
		

			assertTrue( target.compare( owSet( [ "a" , "b", "c" ] ) ) );
		

			source.remove( "a" );

		
			assertTrue( target.compare( owSet( [ "b", "c" ] ) ) );
		
		

			op.dispose();
			
			source.remove( "b" );
		
			

			assertTrue( target.compare( owSet( [ "b", "c" ] ) ) );
			
			
		
		}		






		private function onlyLowerCase( e:* ):Boolean
		{
			return String( e ) == String( e ).toLowerCase( );
		}







		
	}

}